package sms;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;
public class Student extends Person {
	private static final String String = null;
	private  int xuehao;  //设置学号
	private  double  yuwen;      //设置语文成绩
	private  double  shuxue;      //设置数学成绩
	private  double  jisuanji;      //设置计算机成绩
	// 总分
	private  double sum;
	// 均分
	private  double average;

	// 获得奖学金等级
	private int scholarshipLevel;


	public  void  set_xuehao(int  x){xuehao=x; }
	public  void  set_yuwen(double  y){yuwen=y; }
	public  void  set_shuxue(double  s){shuxue=s; }
	public  void  set_jisuanji(double  j){jisuanji=j; }
	public  void  set_sum(){ this.sum = this.yuwen + this.shuxue + this.jisuanji; }
	public void set_average(){
		this.average = (this.yuwen + this.shuxue + this.jisuanji) / 3;
	}
	int get_xuehao() {    return xuehao;  }
	double get_yuwen() {    return yuwen;  }
	double get_shuxue() {    return shuxue; }
	double get_jisuanji() {   return jisuanji; }
	double get_sum() {    return this.sum; }


	double get_average() {  //陈雪梅
		return (this.yuwen + this.shuxue + this.jisuanji) / 3;
	}
	//1参数构造方法
	Student( ){    }
	//2--7参数构造方法
	Student (String  addr  ,String  name, String  sex,  int  age , double  y, double  shu, double  ji)
	{
		super(addr,name,sex,age);//调用父类的四个属性
		yuwen=y;
		shuxue=shu;
		jisuanji=ji;
	}
	//3--5参数构造方法
	Student ( double  y, double  shu, double  ji,double sum,double average){
		yuwen=y;shuxue=shu;jisuanji=ji;sum=sum;average=average;}
	//show方法，多态——子类重写父类的方法
	public void  show(  ){
		//显示出Student类的9个属性
		Scanner reader=new Scanner(System.in);
		Student wang=new Student();
		System.out.println("地址："+get_per_addr());
		System.out.println("姓名："+get_per_name());
		System.out.println("性别"+get_per_sex());
		System.out.println("年龄"+get_per_age());
		System.out.println("语文成绩:"+get_yuwen());
		System.out.println("数学成绩:"+get_shuxue());
		System.out.println("计算机成绩:"+get_jisuanji());
		System.out.println("三科总分:"+this.sum);
		System.out.print("三科平均分:");
//		String s=String.format("%.1f",get_average());
		double s = get_average();
		System.out.printf("%.2f\n", s);
	}

	/**
	 * 设置奖学金等级
	 */
	public void setScholarshipLevel() {
		if (this.get_average() >= 90) {
			this.scholarshipLevel = 1; // 一等
		}
		else if (this.get_average()>=80 && this.get_average() < 90) {
			this.scholarshipLevel = 2; // 二等
		}
		else if (this.get_average() >= 70 && this.get_average() < 80) {
			this.scholarshipLevel = 3; // 三等
		}
	}

	public int getScholarshipLevel(){
		return this.scholarshipLevel;
	}

}
	

